﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;


namespace StoreM
{
    class AddProductDataProcess
    {

        public SqlConnection Connect()
        {
            SqlConnection sql = new SqlConnection(@"Data Source=.\die4top;Initial Catalog=Store;Integrated Security=True");
            sql.Open();
            return sql;
        }
        public void Disconnect()
        {
            SqlConnection sql = Connect();
            sql.Dispose();
            sql.Close();
            sql = null;
        }
        public DataTable CreataTable(string s)
        {
            using (SqlConnection sql = Connect())
            {
                SqlDataAdapter sqldata = new SqlDataAdapter(s, sql);
                DataTable dt = new DataTable();
                sqldata.Fill(dt);
                return dt;
            }
        }
        public void ExecuteNonQuery(string s)
        {
            using (SqlConnection sql = Connect())
            {
                SqlCommand coon = new SqlCommand(s, sql);
                coon.ExecuteNonQuery();

            }
        }
    }
}
